forum

home / developersection / forums / generating a lambda by passing in a property name for use in .count() with where condition

Generating a lambda by passing in a property name for use in .Count() with Where condition

Anonymous User 1880 29-Jan-2014

I'm trying to generate a lambda expression, by passing in the property name to filter on as a string, then I  need to count the results where an "Enum" is set to a certain status

var expressionParam = Expression.Parameter(typeof (ArtworkPage), "page");

var body = Expression.Property(expressionParam, property);

var lambda = Expression.Lambda(body, expressionParam,).Compile();

int approvedList = GetArtworkUploadPages(artwork.Id).Count(lambda);

How do I get the final piece of the puzzle in passing what enum value I want to filter by into the lambda?


c# c# 
Updated on 29-Jan-2014

I am a content writter !


Message
Can you answer this question?

Answer

1 Answers

Liked By